package com.loser.rpc.room.rpc;

import com.loser.module.base.common.APiResponsePage;
import com.loser.module.base.common.ApiResponse;
import com.loser.module.base.proto.sdk.cmd.ServiceNames;
import com.loser.rpc.room.dto.req.RoomPageReq;
import com.loser.rpc.room.dto.req.RoomSaveReq;
import com.loser.rpc.room.dto.req.RoomUpdateReq;
import com.loser.rpc.room.dto.resp.RoomInfoResp;
import com.loser.rpc.room.fallback.RoomFeignFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = ServiceNames.ROOM, fallback = RoomFeignFallBack.class)
@Component
public interface RoomFeign {

    @PostMapping("/room/save")
    ApiResponse<Boolean> save(@RequestBody RoomSaveReq req);

    @PostMapping("/room/update")
    ApiResponse<Boolean> update(@RequestBody RoomUpdateReq req);

    @DeleteMapping("/room/delete/{id}")
    ApiResponse<Boolean> deleteById(@PathVariable("id") Long id);

    @GetMapping("/room/get/{id}")
    ApiResponse<RoomInfoResp> getById(@PathVariable("id") Long id);

    @PostMapping("/room/page")
    APiResponsePage<RoomInfoResp, Object> queryList(@RequestBody RoomPageReq req);

}
